@isTest
private class ShiyeApplicationGoodDetailCreatedTest{
     static testMethod void testMethod1() {

        ShiyeApplicationGoodDetailCreated s = new ShiyeApplicationGoodDetailCreated();
        s.test();
    
        /*
         //创建客户
         Account acc =  TestUtils.createAccount();
         insert acc ;
         
         //创建合同
         Contract__c c = TestUtils.createContract();
         c.Account__c = acc.Id;
         c.Corpcode__c = 'MKSY';
         c.Status__c = '已生效';
         c.ManualImport__c = true;
         insert c;
         
        ProductStructure__c ps2 = new ProductStructure__c();
        ps2.Classify3__c = '试剂';
        insert ps2;
         //创建产品
         Product__c p = TestUtils.createProduct();
         p.ProductStructure__c = ps2.Id;
         insert p;
         
         //创建合同产品
         ContractProduct__c cp = new ContractProduct__c();
         cp.Contract__c = c.Id;
         cp.Product__c = p.Id;
         insert cp;
         
         //创建价格 
         Price__c pr = new Price__c();
         pr.Product__c = p.Id;
         pr.Company__c = '四川省迈克实业有限公司';
         pr.CompanyBottomPrice__c = 10.0;
         pr.HospitalBottomPrice__c = 10.0;
         insert pr;
         
           /// 日期处理
        Integer m = Date.today().month(); //当前月份
        Integer y = Date.today().year();  //当前年份 
       ///取上月
         if(m == 1){
        m = 12 ;
            y -= 1;
        }else{
        m -= 1;
            
        }
        
        String  month = String.valueOf(m) + '月';
        String  year= String.valueOf(y) + '年';
         //创建上月平均价
         AveragePrice__c apr = new AveragePrice__c();
         apr.Product__c = p.Id;
         apr.Company__c = '四川省迈克实业有限公司';
         apr.AveragePrice__c = 10.0;
         apr.Month__c = month;
         apr.Year__c = year ;
         insert apr;
         //流水号
         NetSerialNumber__c n = new NetSerialNumber__c();
         n.Product__c = p.Id;
         n.Company__c = '四川省迈克实业有限公司';
         n.NetSerialNumber__c = '10';
         insert n;
         
         //创建实业借货申请
         ShiyeApplicationGoods__c sg = new ShiyeApplicationGoods__c();
         sg.Customer__c = acc.Id;
         insert sg;
         
        PageReference page = new PageReference('/apex/ShiyeApplicationGoodDetailCreated?id=' + sg.Id);
        System.Test.setCurrentPage(page);
        ShiyeApplicationGoodDetailCreated sPage = new ShiyeApplicationGoodDetailCreated(new ApexPages.StandardController(sg));
        sPage.company = '四川省迈克实业有限公司';
         sPage.init();
         
        System.assertEquals(1, sPage.originds.size());
        
        sPage.product = '尿有形成份检测稀释液UPS';
        sPage.brand = '济南希森美康';
        sPage.category = '临检';
        sPage.serialNo ='ZG801009';
        sPage.search();
         System.assertEquals(1, sPage.ds.size());

        for( ShiyeApplicationGoodDetailCreated.ShiyeApplicationGoodDetailBean s : sPage.ds){
            ///退货1个
            s.isChecked = true;
            s.OrderQuantity = 1 ;
        }
        sPage.save();
        System.debug('暗号');
        List<ShiyeApplicationGoodsDetails__c> res = [select Id from ShiyeApplicationGoodsDetails__c where ShiyeApplicationGoods__c = :sg.Id];
        System.assertEquals(0, res.size());
        */
         
     }
}